{% extends "departments/base.html" %}
<!-- stylesheet -->
{% block title %}
{% if association_post.title %}
{{association_post.title}}
{% else %}
暂无文章
{% endif %}
{% endblock %}
{% block departments-external %}
<script language="javascript">
	$(function () {
        //为所有的class为delete的按钮点击动作添加行为函数
        $(".delete").click(function () {
            //获取class为delete的超链接的地址
            var href = $(this).attr("href");
            //为隐藏域的action赋值并提交
            $("form").attr("action", href).submit();
            return false;
        })
    })
</script>
{% endblock %}]
{% block logo %}
            <!-- 考虑到并非都有社团logo -->
            {% if association_post.association.image %}
          <a href="#" title="{{association_post.association.name}}"><img src="{{ association_post.association.image.url }}" width="120" height="120" border="0" alt="{{association_post.association.name}}" title="{{association_post.association.name}}"></a><!--#endeditable-->
            {% else %}
          <a href="#" title="{{association_post.association.name}}"><img src="https://pic.downk.cc/item/5ebf6257c2a9a83be59950c4.png" width="120" height="120" border="0" alt="{{association.name}}" title="{{association.name}}"></a><!--#endeditable-->
            {% endif %}
{% endblock %}
{% block department %}
  <div class="bottom-header blog">
    <div class="container">
      <div class="row">
        <div class="col-sm-12">

          <h2><!--#begineditable name="文章标题" action="webber.wbst.com.news.DetailNews" layout="/system/_component/news/content/tpltitle.jsp" tpltype="1" contype="" clone="" viewid="153010" contentviewid="" tagname="文章标题"-->
              {{association_post.title}}<!--#endeditable--></h2>
        </div>
      </div>
    </div>
  </div>
{% endblock %}
{% block introduction %}
{% if user == association_post.author %}
<div class="content_place">
    <nav aria-label="breadcrumb">
        <ol class="breadcrumb">
            <li class="breadcrumb-item">
                <a class="btn btn-primary" href="{% url 'departments:update_association_post' association_post.id %}">
                    修改文章
                </a>
            </li>
            <li class="breadcrumb-item">
                <a class="btn btn-primary" data-toggle="modal" data-target="#myModal" >删除文章</a>
            </li>
<!-- 模态框（Modal） -->
<div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
	<div class="modal-dialog">
		<div class="modal-content">
			<div class="modal-header">
				<button type="button" class="close" data-dismiss="modal" aria-hidden="true">
					&times;
				</button>
				<h4 class="modal-title" id="myModalLabel">
					提示
				</h4>
			</div>
			<div class="modal-body">
				您确定要删除该篇文章吗？
			</div>
			<div class="modal-footer">
				<button type="button" class="btn btn-default" data-dismiss="modal">取消
				</button>
                <div class="delete">
				<a class="btn btn-primary" href="{% url 'departments:delete_association_post' association_post.id %}">
					确认
				</a>
                </div>
			</div>
		</div><!-- /.modal-content -->
	</div><!-- /.modal -->
</div>
            <form
      style="display:none;"
      id="safe_delete"
      action="{% url 'departments:delete_association_post' association_post.id %}"
      method="post"
      >
    {% csrf_token %}
    <button type="submit">发送</button>
            </form>
        </ol>
    </nav>
</div>
{% endif %}
{% if association_post.status == 0 %}
<script>
function myFunction1(){
	alert("该社团文章目前处于草稿阶段，暂未公开");
}
	window.onload=myFunction1()
</script>
{% endif %}
<div class="container">
  <div class="row">
    <div class="col-sm-8">
      <section id="blog">
        <article class="blog-post"><!--#begineditable name="文章内容" action="webber.wbst.com.news.DetailNews" layout="/system/_component/news/content/tpltitle.jsp" tpltype="1" contype="" clone="" viewid="152976" contentviewid="" tagname="文章内容"-->
<h2 class="blog-post-title">{{association_post.title}}</h2>
<div class="blog-post-meta">
    {% if association_post.author %}
    <span class="post-meta-author"><i class="fa fa-user"></i> 发表人：{{association_post.author}} </span>
    {% endif %}
    {% if association_post.created_time %}
    <span class="post-meta-time"><i class="fa fa-calendar"></i> 时间：{{association_post.created_time}}</span>
    {% endif %}
    {% if association_post.association.campus %}
    <span class="post-meta-categories"><i class="fa fa-folder-o"></i> {{association_post.association.campus}} </span>
    {% endif %}
    {% if association_post.nov %}
    <span class="post-meta-author"><i class="fa fa-eye"></i> 浏览量：{{association_post.nov}} </span>
    {% endif %}
</div>
{% if not association_post %}
<p>该篇文章不存在，您可以返回主页</p>
<script>
function myFunction(){
	alert("您好，走迷路了");
}
	window.onload=myFunction()
</script>
{% endif %}
{% if association_post.desc %}
<div class="blog-post-entry">
    <p><span style="font-size: 20px;"><strong><span style="color: rgb(38, 38, 38);">文章摘要：</span></strong></span></p>
<p><span>{{association_post.desc}}</span></p>
    </div>
{% endif %}
{% if association_post.content %}
<div class="blog-post-entry">
    <p><span style="font-size: 20px;"><strong><span style="color: rgb(38, 38, 38);">文章详情：</span></strong></span></p>
<p><span>{{association_post.content|safe}}</span></p>
    </div>
{% endif %}
        </article></section></div></div>
</div>
{% endblock %}